package at.wwu.tunes2db.export;

import java.io.IOException;
import java.sql.SQLException;

import org.apache.log4j.Logger;

import at.wwu.tunes2db.types.*;

public class Profiler implements Destination {

    private static Profiler instance = null;
    
    private Runtime rt = Runtime.getRuntime();
    
    private int tracks = 0;
    
    private Track lastTrack = null;

    private static final Logger log = Logger.getLogger(Profiler.class.getName());
    
    public static Profiler getInstance() {
        if (instance==null) {
            instance = new Profiler();
        }
        return instance;
    }
    
    private Profiler() {
        return;
    }

    public boolean addAlbum(Album l) throws SQLException {
        // TODO Auto-generated method stub
        return false;
    }

    public boolean addArtist(Artist a) throws SQLException {
        // TODO Auto-generated method stub
        return false;
    }

    public boolean addGenre(Genre g) throws SQLException {
        // TODO Auto-generated method stub
        return false;
    }

    public boolean addTrack(Track t) throws SQLException { 
        lastTrack = t;
        if (tracks++%1000==0) {
            log.debug("free: "+rt.freeMemory()+", max: "+rt.maxMemory()+", total: "+rt.totalMemory());
        }
        return false;
    }

    public void close() {
        // TODO Auto-generated method stub

    }

    public void open() throws ClassNotFoundException, SQLException, IOException {
        // TODO Auto-generated method stub

    }

    public boolean addKind(Kind k) throws SQLException {
        // TODO Auto-generated method stub
        return false;
    }

    public boolean addType(Type k) throws SQLException {
        // TODO Auto-generated method stub
        return false;
    }

    public int getTracks() {
        return tracks;
    }

    public Track getLastTrack() {
        return lastTrack;
    }

}
